package com.zzc.service.impl;

import com.zzc.domain.Product;
import com.zzc.mapper.ProductMapper;
import com.zzc.service.ProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Zzc
 * @since 2020-08-05
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {

    @Autowired
    private ProductMapper productMapper;

    @Override
    public List<Product> getProductList() {

        return productMapper.selectList(null);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int productInventoryDecr(int productId) {
        return productMapper.updateInventory(productId);

    }


}
